using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerIdleState : PlayerGroundState
{
    public PlayerIdleState(Player _player, PlayerStateMachine _stateMachine, string _animBoolName) : base(_player, _stateMachine, _animBoolName)
    {

    }

    public override void Enter()
    {
        base.Enter();
        // 进入待机状态时防止滑动
        player.SetZeroVelocity();
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();
        // 限制墙体边缘不能移动-不是很必要的玩意

        // if (xInput == player.dashDir && player.IsWallDetected()) return;//第一种
        // if (!player.IsWallDetected() || xInput != player.facingDir)//第二种
        // {

        if (xInput != 0 && !player.isBusy)// 有x轴输入且角色不忙就进入移动状态
        {
            stateMachine.ChangeState(player.moveState);
        }
        // }

    }
}
